@import '../../styles/variables';

// Format Converter Styles
.format-converter {
  min-height: calc(100vh - 64px);
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  padding: @spacing-xl;

  &__header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: @spacing-2xl;
    margin-bottom: @spacing-2xl;
    position: relative;
    overflow: hidden;
    color: @white;

    &::before {
      content: '';
      position: absolute;
      top: -50%;
      right: -20%;
      width: 200px;
      height: 200px;
      background: rgba(255, 255, 255, 0.1);
      border-radius: 50%;
    }
  }

  &__title-section {
    display: flex;
    align-items: center;
    gap: @spacing-lg;
    position: relative;
    z-index: 1;
  }

  &__title-icon {
    width: 64px;
    height: 64px;
    opacity: 0.9;
  }

  &__title {
    font-size: @font-size-3xl;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, #fff 0%, #e2e8f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  &__description {
    font-size: @font-size-lg;
    opacity: 0.9;
    margin: @spacing-sm 0 0 0;
  }

  &__content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: @spacing-2xl;
  }

  // Upload Section
  &__upload-section {
    .card();
  }

  &__upload-card {
    padding: @spacing-2xl;
  }

  &__upload-header {
    text-align: center;
    margin-bottom: @spacing-2xl;

    h3 {
      font-size: @font-size-xl;
      font-weight: 600;
      color: @gray-900;
      margin: @spacing-sm 0;
    }

    p {
      font-size: @font-size-base;
      color: @gray-600;
      margin: 0;
    }

    .format-converter__upload-icon {
      width: 48px;
      height: 48px;
      color: @primary-color;
      margin: 0 auto @spacing-md;
    }
  }

  &__upload-area {
    border: 2px dashed @gray-300;
    border-radius: 12px;
    padding: @spacing-2xl;
    transition: all 0.3s ease;

    &:hover {
      border-color: @primary-color;
    }
  }

  &__dropzone {
    text-align: center;

    &-icon {
      width: 64px;
      height: 64px;
      color: @gray-400;
      margin: 0 auto @spacing-md;
    }

    p {
      font-size: @font-size-lg;
      color: @gray-700;
      margin: 0;
    }

    &-subtitle {
      font-size: @font-size-sm !important;
      color: @gray-500 !important;
      margin: @spacing-xs 0 @spacing-lg !important;
    }
  }

  &__upload-button {
    .btn-primary();
    padding: @spacing-md @spacing-xl;
    font-size: @font-size-base;
  }

  // Files Section
  &__files-section {
    .card();
    padding: @spacing-xl;
  }

  &__files-title {
    font-size: @font-size-lg;
    font-weight: 600;
    color: @gray-900;
    margin-bottom: @spacing-lg;
  }

  &__files-list {
    display: flex;
    flex-direction: column;
    gap: @spacing-md;
  }

  &__file-item {
    display: flex;
    align-items: center;
    gap: @spacing-md;
    padding: @spacing-md;
    background: @gray-50;
    border-radius: 12px;
    transition: all 0.2s;

    &:hover {
      background: @gray-100;
    }
  }

  &__file-icon {
    width: 40px;
    height: 40px;
    color: @gray-600;
    flex-shrink: 0;
  }

  &__file-info {
    flex: 1;
    min-width: 0;
  }

  &__file-name {
    font-size: @font-size-sm;
    font-weight: 500;
    color: @gray-900;
    .truncate();
  }

  &__file-details {
    display: flex;
    gap: @spacing-md;
    margin-top: @spacing-xs;

    span {
      font-size: @font-size-xs;
      color: @gray-500;
    }
  }

  &__file-actions {
    flex-shrink: 0;
  }

  &__remove-button {
    .btn-outline();
    font-size: @font-size-xs;
    padding: @spacing-xs @spacing-sm;
  }

  // Settings Section
  &__settings-section {
    .card();
  }

  &__settings-card {
    padding: @spacing-2xl;
  }

  &__settings-header {
    display: flex;
    align-items: center;
    gap: @spacing-md;
    margin-bottom: @spacing-xl;

    h3 {
      font-size: @font-size-xl;
      font-weight: 600;
      color: @gray-900;
      margin: 0;
    }

    .format-converter__settings-icon {
      width: 24px;
      height: 24px;
      color: @primary-color;
    }
  }

  &__settings-content {
    display: flex;
    flex-direction: column;
    gap: @spacing-xl;
  }

  &__setting-group {
    display: flex;
    flex-direction: column;
    gap: @spacing-md;
  }

  &__setting-label {
    font-size: @font-size-lg;
    font-weight: 600;
    color: @gray-900;
  }

  &__formats-grid,
  &__quality-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: @spacing-md;
  }

  &__format-option,
  &__quality-option {
    .card();
    padding: @spacing-lg;
    text-align: left;
    border: 2px solid @gray-200;
    transition: all 0.3s ease;
    cursor: pointer;

    &:hover {
      border-color: @primary-color;
      transform: translateY(-2px);
    }

    &--active {
      border-color: @primary-color;
      background: @primary-color-light;
    }
  }

  &__format-name,
  &__quality-name {
    font-size: @font-size-base;
    font-weight: 600;
    color: @gray-900;
    margin-bottom: @spacing-xs;
  }

  &__format-description,
  &__quality-description {
    font-size: @font-size-sm;
    color: @gray-600;
    line-height: 1.4;
  }

  &__advanced-settings {
    border-top: 1px solid @gray-200;
    padding-top: @spacing-xl;
  }

  &__details {
    border: 1px solid @gray-200;
    border-radius: 8px;
    overflow: hidden;
  }

  &__summary {
    padding: @spacing-md;
    background: @gray-50;
    font-weight: 600;
    color: @gray-900;
    cursor: pointer;
    list-style: none;

    &::marker {
      display: none;
    }

    &::-webkit-details-marker {
      display: none;
    }

    &::before {
      content: '▶';
      margin-right: @spacing-sm;
      transition: transform 0.3s ease;
    }

    details[open] &::before {
      transform: rotate(90deg);
    }
  }

  &__advanced-content {
    padding: @spacing-md;
    background: @white;
  }

  &__advanced-group {
    margin-bottom: @spacing-lg;

    &:last-child {
      margin-bottom: 0;
    }

    label {
      display: block;
      font-size: @font-size-sm;
      font-weight: 500;
      color: @gray-700;
      margin-bottom: @spacing-xs;
    }
  }

  &__select {
    width: 100%;
    padding: @spacing-sm;
    border: 1px solid @gray-300;
    border-radius: 6px;
    font-size: @font-size-sm;
    background: @white;

    &:focus {
      outline: none;
      border-color: @primary-color;
      box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    }
  }

  // Action Section
  &__action-section {
    .card();
  }

  &__action-card {
    padding: @spacing-2xl;
  }

  &__progress-section {
    text-align: center;
  }

  &__progress-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: @spacing-sm;
    margin-bottom: @spacing-lg;

    span {
      font-size: @font-size-lg;
      font-weight: 600;
      color: @gray-900;
    }
  }

  &__progress-icon {
    width: 24px;
    height: 24px;
    color: @primary-color;
    animation: spin 2s linear infinite;
  }

  &__progress-bar {
    width: 100%;
    height: 8px;
    background: @gray-200;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: @spacing-md;
  }

  &__progress-fill {
    height: 100%;
    background: linear-gradient(90deg, @primary-color, @primary-color-dark);
    border-radius: 4px;
    transition: width 0.3s ease;
  }

  &__progress-text {
    font-size: @font-size-sm;
    color: @gray-600;
    font-weight: 500;
  }

  &__convert-section {
    text-align: center;
  }

  &__convert-button {
    .btn-primary();
    padding: @spacing-lg @spacing-2xl;
    font-size: @font-size-lg;
    font-weight: 600;

    &:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }
  }

  &__convert-icon {
    width: 20px;
    height: 20px;
    margin-right: @spacing-sm;
  }

  &__convert-info {
    display: flex;
    justify-content: center;
    gap: @spacing-xl;
    margin-top: @spacing-lg;
  }

  &__info-item {
    display: flex;
    align-items: center;
    gap: @spacing-xs;
    font-size: @font-size-sm;
    color: @gray-600;
  }

  &__info-icon {
    width: 16px;
    height: 16px;
    color: @gray-500;
  }

  // Card mixin
  .card() {
    background: @white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(229, 231, 235, 0.5);
  }

  // Button mixins
  .btn-primary() {
    background: linear-gradient(135deg, @primary-color, @primary-color-dark);
    color: @white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    &:hover:not(:disabled) {
      transform: translateY(-1px);
      box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.3);
    }
  }

  .btn-outline() {
    background: transparent;
    color: @gray-600;
    border: 1px solid @gray-300;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;

    &:hover {
      border-color: @red-500;
      color: @red-600;
    }
  }

  @keyframes spin {
    0% {
      transform: rotate(0deg);
    }
    100% {
      transform: rotate(360deg);
    }
  }
}

// Utility classes for other components
.video-compressor,
.audio-extractor {
  .card {
    background: @white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(229, 231, 235, 0.8);
  }
}